﻿using System;
using biz.ritter.javapi.util;
using Nofs.Net.Common.Interfaces.Domain;

namespace Nofs.Net.Common.Interfaces.Cache
{
    public class KeyIdentifier : KeyIdentifier<object>
    {
        public KeyIdentifier()
            :base()
        {
        }

        public KeyIdentifier(object reference)
            :base(reference)
        {
            
        }

        public KeyIdentifier(UUID id, object reference)
            : base(id, reference)
        {
        }
    }

    

    public class KeyIdentifier<T> : IKeyIdentifier
    {
        private UUID _id;
        private T _ref;

        public KeyIdentifier()
        {
        }

        public KeyIdentifier(T reference)
        {
            _ref = reference;
            _id = UUID.randomUUID();
        }

        public KeyIdentifier(UUID id, T reference)
        {
            _ref = reference;
            _id = id;
        }

        public UUID getID() { return _id; }
        public void setID(UUID id) { _id = id; }

        public Object getReference()
        {
            return _ref as Object;
        }

        public void setReference(T value) { _ref = value; }
    }
}
